-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blueprints: add Blueprints filtering #1607
Conversation
6ed6d90
to
43585e7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ezr-ondrej ! looks and works great 👍
I left a few inline comments, and also I've found a small glitch once clearing the search input:
Screen.Recording.2024-01-29.at.14.43.21.mov
const [searchQuery, blueprintsFilter, setBlueprintsFilter] = | ||
useDebouncedSearch('', 500); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I won't block this custom hook, but lodash has debounce implementation already, why not using it and keep it as regular state?
import _debounce from 'lodash/debounce';
const debounceFn = useCallback(_debounce(setBlueprintsFilter, 500), []);
<SearchInput
placeholder="Search by name or description"
value={filter}
onChange={(_event, value) => debounceFn(value)}
onClear={() => onChange('')}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, 500 ms feels a bit long to me, would 300 be better? Thinking of this delay (and also fetching time), how would be adding a spinner or another indicator?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because I did not find a way how to use lodash debounce 😛
Definitelly on looks better, let me improve it! 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:)
I'm thinking that backend and frontend filtering would work the best together , we already have up to 100 blueprints records in the store by default, we can filter it locally by default for instant result, and update the store if there were any updates from the debounced query. though I think this enhancement can be implemented as a follow up as part of general optimistic updating refactor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's IMO amazing idea, we should discuss it with Andrew Dewar, he did quite a lot of optimistic updating, we can get some lessons learned :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow... it's amazing, just 200 ms less and it really feels much smoother experience.
So I've read about it because I was amazed and I've learned that smooth feeling is when the interaction computer <-> human is below 400ms, cool
@@ -61,7 +81,7 @@ const BlueprintsSidebar = ({ | |||
<StackItem> | |||
<SearchInput |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've used count blueprints
it feels more user friendly, but kinda long, so I'm not strongly for that, happy to go just with the number if you'd think it's better ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree, feels friendly and verbose, but a bit too long IMHO
onClear={() => onChange('')} | ||
/> | ||
</StackItem> | ||
<StackItem>No Blueprints found</StackItem> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
de521a7
to
3236536
Compare
Thanks for the amazing pointers Amir, I've incorporated almost all of them :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ezr-ondrej ! works smoothly indeed 👍
just a minor nitpick
}: blueprintProps) => { | ||
const [blueprintFilter, setBlueprintFilter] = useState(''); | ||
const blueprintsCount = blueprints?.length || 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just the fetched data length, we can use the meta object for the query search count :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're completely right! :)
Adding that.
@@ -85,6 +102,8 @@ export const LandingPage = () => { | |||
blueprints={blueprints?.data} | |||
selectedBlueprint={selectedBlueprint} | |||
setSelectedBlueprint={setSelectedBlueprint} | |||
filter={blueprintsSearchQuery} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I.e, adding -
blueprintsCount={blueprints?.meta.count}
3236536
to
47e72fd
Compare
hmm while adding the blueprintsTotal, I've realized we can move the query to the sidebar, the only information is the selected blueprint. So I've moved everything else down to the sidebar component. It looks bit cleaner on the LandingPage component side. |
47e72fd
to
3af6c24
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks @ezr-ondrej 👍
3af6c24
to
f0fd731
Compare
Thanks for working on this! I've got an issue with the filter not filtering on |
For me it still loads up data from the server 🤔 |
f0fd731
to
367af83
Compare
/retest |
1 similar comment
/retest |
f6eb8da
to
c22f12f
Compare
/retest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 This works great! Thanks a lot.
/retest |
1 similar comment
/retest |
Enables Blueprints filtering. Given this is a server side filtering, it also ads Debounce hook. This hook enables delay the API request to save server roundtrips. Refs HMS-3389
c22f12f
to
80d785f
Compare
/retest |
@jrusz can you have a look at why the tests are failing please? We've been restarting them a bunch of time without any success. |
Yeah there is some more widespread issue happening, other consoledot apps are seeing the same issue in their pr_check jobs... Nobody seems to know what's wrong yet... I believe that this should be ok to merge though as this should be behind the feature flag. |
Thanks for the heads up, I'm merging then. |
Enables Blueprints filtering.
Given this is a server side filtering, it also adds Debounce hook.
This hook enables delay the API request to save server roundtrips.
Refs HMS-3389
Screencast.from.2024-01-30.10-19-03.webm